package com.keycloak.admin.map;

import com.keycloak.admin.config.Myprops;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Service
public  class  ClientMap {

    @Resource
    Myprops myProps;


    private   Map<String,String> clientMap = new HashMap<>();

    /*public  ClientMap(){
        clientMap.put("driver",myProps.getKeycloakClientSecret());
        clientMap.put("passenger","0d583d64-199e-4397-af33-46d3c7c796fc");
    }*/

     public  String getClientSecret(String clientId){
        if(clientMap.size() == 0){
            clientMap.put("driver",myProps.getKeycloakClientSecret());
            clientMap.put("passenger","cfcbeb98-7a7e-4996-9947-b7590c05c9a9");
        }
        return clientMap.get(clientId);
     }

     public Integer getMapSize(){

      return clientMap.size();
     }

}
